#ifndef _DEBUG_H
#define _DEBUG_H

#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <QDebug>

//#define RELEASE
#ifdef _MSC_VER
#define DBG(...) \
	print_error( __FILE__, (char*)__FUNCTION__, __LINE__, __VA_ARGS__)

#define DBG_QS(...) \
	print_error_qs( __FILE__, (char*)__FUNCTION__, __LINE__, __VA_ARGS__)

#else
#ifndef RELEASE
#define DBG(args ...) \
	print_error( __FILE__, (char*)__FUNCTION__, __LINE__, ##args )
#define DBG_QS(args ...) \
	print_error_qs( __FILE__, (char*)__FUNCTION__, __LINE__, ##args)	
#else
#define DBG(args ...) 
//#define DBG printf
#endif
#endif
#define MSG(...)	printf( __VA_ARGS__)
void print_error_qs(const char* file,const char* function, int line, const QString fmt);
void print_error(const char* file, const char* function, int line, const char *fmt, ...);
void hex_dump( unsigned char * buf, int len );
void debug_term_on();
void debug_term_off();
void debug_file_on();
void debug_file_off();
void debug_set_dir(char* str);

#endif //_DEBUG_H

